<?php
    
    class Images_model extends CI_Model{
        public function __construct()
        {
            $this->load->database();
            $this->load->library('session');
        }
        
        
        public function getAll()
        {
            $sql = "select * from images order by id";
            $query = $this->db->query($sql);
         
            return $query->result_array();
        }

    
        public function add($url)
        {
            $data = array('url' => $url,
                        'title' => $_POST ['title']
                    );

            $this->db->insert('images', $data);
        }
        
      
        
        
        public function delete($id)
        {
            $this->db->where('id', $id);  
            $this->db->delete('images');
        }
        

}